Through Lingo

This time there is no Havok Export (HKE) file and no Shockwave 3D (W3D) file that can be imported. Hence display and physical information must be created directly in Lingo.

First, create the empty 3D world:

  1. Click the Insert menu.
  2. Select Media Element from the Insert menu.
  3. Select Shockwave 3D from the Media Element submenu.

This adds the 3D cast member to the cast. This may then be dragged onto the stage. To create the empty Havok simulation:

      1. Click the Insert menu.
      2. Select Media Element from the Insert menu.
      3. Select Havok Physics Scene from the Media Element submenu.

This adds an empty Havok cast member to the cast. Now add a Physics (No HKE) behavior to the cast (from the Havok > Setup behavior library) by dragging it onto the stage - ensure that the Which Havok Cast Member parameter is set to the Havok Physics Scene member name.

Now we need to create the physics scene as well as the 3D scene from scratch.

The Lingo function below creates the 3D models for the scene followed by the rigid bodies. In this case the ground primitive and text rigid bodies are actually constructed as axis-aligned bounding boxes.

on createScene

s = member( "BlankScene" )
hk = member( "BlankHavok" )
txt = member( "Text" )

s.resetWorld()

-- create ground
mr = s.newmodelresource("GroundPlaneRes", #box)
mr.width = 150
mr.length = 50
mr.height = 100
m = s.newmodel("GroundPlane", mr)
m.transform.rotation = vector(-90,0,0)
m.transform.position = vector(0,250,-200)

m.addModifier(#meshdeform)
hk.makeFixedRigidBody(m.name, true, #box)

-- point camera
c = s.camera[1]
c.transform.position = vector(50,-50,-100)
c.pointat(m.transform.position + vector(0,0,50), vector(0,0,1))
c.hither = 1
c.yon = 1000

-- create text
txt.text = "Hello World"
mr = txt.extrude3D( s )
mr.bevelType = 1
mr.bevelDepth = 0.1
mr.smoothness = 6
m = s.newModel("Text", mr)
m.transform.position = vector(-75,250,0)
m.transform.rotation = vector(90,0,0)
m.addModifier(#meshdeform)
hk.makeMovableRigidBody(m.name, 1000.0, true, #box)

end